package jmine.tec.subscription.replicator;

import jmine.tec.subscription.Publication;
import jmine.tec.subscription.Publisher;
import jmine.tec.subscription.SubscriptionManager;
import jmine.tec.subscription.SubscriptionSettings;
import jmine.tec.subscription.impl.PartialPublication;
import jmine.tec.utils.io.IOUtils;

/**
 * Replicator que apenas serializa os objetos para garantir que irao funcionar
 * 
 * @author takeshi
 */
public class SerializerReplicator extends AbstractIdentifiedReplicator {

    /**
     * {@inheritDoc}
     * 
     * @see jmine.tec.subscription.replicator.PublicationReplicator#synchronizePartialPublication(jmine.tec.subscription.Publisher,
     * jmine.tec.subscription.SubscriptionSettings, jmine.tec.subscription.impl.PartialPublication,
     * jmine.tec.subscription.SubscriptionManager)
     */
    public <P extends Publication> void synchronizePartialPublication(Publisher<P> publisher, SubscriptionSettings settings,
            PartialPublication<P> publication, SubscriptionManager source) {
        IOUtils.serializeObject(publication);
        IOUtils.serializeObject(settings);
    }

    /**
     * {@inheritDoc}
     * 
     * @see jmine.tec.subscription.replicator.PublicationReplicator#synchronizePublication(jmine.tec.subscription.Publisher,
     * jmine.tec.subscription.SubscriptionSettings, jmine.tec.subscription.Publication, jmine.tec.subscription.SubscriptionManager)
     */
    public <P extends Publication> void synchronizePublication(Publisher<P> publisher, SubscriptionSettings settings, P publication,
            SubscriptionManager source) {
        IOUtils.serializeObject(publication);
        IOUtils.serializeObject(settings);
    }

}
